from building import *

cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = []

if GetDepend('SUPPORT_BEEP_DRV'):
    CPPPATH.append(cwd + '/BeepDrv')
    src += Glob('BeepDrv/BeepDrv.c') 

if GetDepend('SUPPORT_BMP'):
    CPPPATH.append(cwd + '/Bmp')

if GetDepend('SUPPORT_BUZZER_DRV'):
    CPPPATH.append(cwd + '/BuzzerDrv')
    if GetDepend('SUPPORT_BUZZER_DRV_ASM32F0'):
      src += Glob('BuzzerDrv/BuzzerDrv_ASM32.c')
    elif GetDepend('SUPPORT_BUZZER_DRV_HC32F4'):
      src += Glob('BuzzerDrv/BuzzerDrv_HC32F4TA.c')  
    elif GetDepend('SUPPORT_BUZZER_DRV_PIC_PWM56'):
        src += Glob('BuzzerDrv/BuzzerDrv_PicPWM56.c')
    elif GetDepend('SUPPORT_BUZZER_DRV_PIC_NOR'):
        src += Glob('BuzzerDrv/BuzzerDrv_Pic.c')
    elif GetDepend('SUPPORT_BUZZER_DRV_SWM341TBT'):   
      src += Glob('BuzzerDrv/BuzzerDrv_SWM341TBT.c')  
    if GetDepend('SUPPORT_BUZZER_MUSIC'):   
      src += Glob('BuzzerDrv/BuzzerMusic.c')  

if GetDepend('SUPPORT_COLOR'):
    CPPPATH.append(cwd + '/Color')
    src += Glob('Color/Color.c') 
    if GetDepend('SUPPORT_COLOR_RGB666'):   
      src += Glob('BuzzerDrv/Color_RGB666.c')  

if GetDepend('SUPPORT_DECODE_GIF'):
    CPPPATH.append(cwd + '/DecodeGIF')
    src += Glob('DecodeGIF/DecodeGIF.c') 

if GetDepend('SUPPORT_DECODE_PNG'):
    CPPPATH.append(cwd + '/DecodePNG')
    src += Glob('DecodeGIF/DecodePNG.c') 

if GetDepend('SUPPORT_DLIGHT'):
    CPPPATH.append(cwd + '/DLight')
    src += Glob('DLight/DLightDrv.c') 

if GetDepend('SUPPORT_EO8_LIGHT'):
    CPPPATH.append(cwd + '/EO8Light')
    src += Glob('EO8Light/EO8Light.c') 

if GetDepend('SUPPORT_EPIC'):
    CPPPATH.append(cwd + '/ePic')
    src += Glob('ePic/ePic.c') 
    if GetDepend('SUPPORT_EPIC_GIF'):
        src += Glob('ePic/PlotGIF.c') 
    if GetDepend('SUPPORT_EPIC_BMP'):
        src += Glob('ePic/PlotIndexBmp.c') 
    if GetDepend('SUPPORT_EPIC_PNG'):
        src += Glob('ePic/PlotPNG.c')  
    if GetDepend('SUPPORT_EPIC_BMP_RLE'):
        src += Glob('ePic/PlotBmpRLE.c') 

if GetDepend('SUPPORT_FILE_FILTER_LIST'):
    CPPPATH.append(cwd + '/FileFilterList')
    src += Glob('FileFilterList/FileFilterList.c') 

if GetDepend('SUPPORT_FONTS'):
    CPPPATH.append(cwd + '/Fons')
    src += Glob('Fons/Fons.c') 

if GetDepend('SUPPORT_GB2312ZM'):
    CPPPATH.append(cwd + '/GB2312ZM')
    if GetDepend('SUPPORT_GB2312ZM_ASC8_ONLY'):
        if GetDepend('SUPPORT_GB2312ZM_ASC8_STD'):
          src += Glob('GB2312ZM/GB2312ZM_Asc8Only.c') 
        elif GetDepend('SUPPORT_GB2312ZM_ASC8_NANO'):
          src += Glob('GB2312ZM/GB2312ZM_Asc8Only2.c') 
        elif GetDepend('SUPPORT_GB2312ZM_ASC5X7'):
          src += Glob('GB2312ZM/GB2312ZM_Asc57Only.c') 
        elif GetDepend('SUPPORT_GB2312ZM_ASC8X16'):
          src += Glob('GB2312ZM/GB2312ZM_Asc816Only.c') 
        elif GetDepend('SUPPORT_GB2312ZM_ASC16X16'):
          src += Glob('GB2312ZM/GB2312ZM_1616YYB0_bin.c')  
    else:
        src += Glob('GB2312ZM/GB2312ZM.c') 

if GetDepend('SUPPORT_IR'):
    CPPPATH.append(cwd + '/IR')
    src += Glob('IR/IrDrv.c') 
    if GetDepend('SUPPORT_IR_KEY_LED4'):
        src += Glob('IR/Ir_KeyLed4.c')
    if GetDepend('SUPPORT_IR_ASM32'):
        src += Glob('IR/Ir_ASM32.c') 
    elif GetDepend('SUPPORT_IR_AVR'):
        src += Glob('IR/Ir_AVR.c') 
    elif GetDepend('SUPPORT_IR_HC32F4A'):
        src += Glob('IR/Ir_HC32F4A.c')   
    elif GetDepend('SUPPORT_IR_HC32A'):
        src += Glob('IR/Ir_HC32A.c')  
    elif GetDepend('SUPPORT_IR_PIC18'):
        src += Glob('IR/Ir_PIC18.c')   
    elif GetDepend('SUPPORT_IR_PIC'):
        src += Glob('IR/Ir_PIC.c')    
    elif GetDepend('SUPPORT_IR_STM32'):
        src += Glob('IR/Ir_STM32.c') 

if GetDepend('SUPPORT_KEY'):
    CPPPATH.append(cwd + '/Key')
    src += Glob('Key/Key.c') 
    if GetDepend('SUPPORT_CB_KEY_LIGHT'):
        src += Glob('Key/Key_cbKeyLIght.c')  
    elif GetDepend('SUPPORT_CB_KEY_IO'):
        src += Glob('Key/Key_cbIO.c')  
    if GetDepend('SUPPORT_QGUI'):
        src += Glob('Key/Key_QGUI.c')   

if GetDepend('SUPPORT_KEY_ACCELERATE'):
    CPPPATH.append(cwd + '/KeyAccelerate') 
    src += Glob('KeyAccelerate/KeyAccelerate.c') 

if GetDepend('SUPPORT_KEY_LIGHT'):
    if GetDepend('SUPPORT_KEY_LIGHT_EO8'):
        CPPPATH.append(cwd + '/KeyLightEO8') 
        src += Glob('KeyLightEO8/KeyLight.c') 
    else:
        CPPPATH.append(cwd + '/KeyLight') 
        src += Glob('KeyLight/KeyLight.c') 
        if GetDepend('SUPPORT_KEY_LIGHT_K4L1'):
            src += Glob('KeyLight/KeyLight_cbK4L1.c') 
        elif GetDepend('SUPPORT_KEY_LIGHT_K4L2'):
            src += Glob('KeyLight/KeyLight_cbK4L2.c') 

if GetDepend('SUPPORT_LED_SEGMENT'):
    CPPPATH.append(cwd + '/Led') 
    src += Glob('Led/Led.c') 
    if GetDepend('SUPPORT_LED_IN_DRV'):
      if GetDepend('SUPPORT_LED_DRV_IO'):
          src += Glob('Led/LedDrv.c')
          src += Glob('Led/LedDrv_CB.c')      
      elif GetDepend('SUPPORT_LED_DRV_SPI'):
          src += Glob('Led/LedDrv_Spi.c') 
      elif GetDepend('SUPPORT_LED_DRV_1652'):
          src += Glob('Led/LedDrv_1652.c')   
          if GetDepend('SUPPORT_LED_DRV_1652_HC32F00X'):
              src += Glob('Led/LedDrv_1652_cbHC32F00Usart.c')  
    if GetDepend('SUPPORT_LED_NUM4'):
        src += Glob('Led/LedNum4.c')   

if GetDepend('SUPPORT_LOG_CMD_LINE'):
    CPPPATH.append(cwd + '/LogCmdLine')
    src += Glob('LogCmdLine/LogCmdLine.c') 
    if GetDepend('SUPPORT_LOG_CMD_LINE_CB_PLOT'):
        src += Glob('LogCmdLine/LogCmdLine_cbPlot.c') 

if GetDepend('SUPPORT_LT4_K1_GUI'):
    CPPPATH.append(cwd + '/Lt4Key1GUI')
    src += Glob('Lt4Key1GUI/Lt4Key1GUI.c') 

if GetDepend('SUPPORT_MKEY'):
    CPPPATH.append(cwd + '/MKey')
    src += Glob('MKey/MKey.c') 

if GetDepend('SUPPORT_MLINE_DISP'):
    CPPPATH.append(cwd + '/MLineDisp')
    src += Glob('MLineDisp/MLineDisp.c') 

if GetDepend('SUPPORT_PLOT'):
    CPPPATH.append(cwd + '/Plot')
    src += Glob('Plot/Plot.c') 
    if GetDepend('SUPPORT_PLOT_PB'):
        src += Glob('Plot/Plot_PB.c')   
    if GetDepend('SUPPORT_PLOT_EXCEL'):
        src += Glob('Plot/Plot_Excel.c')     
    if GetDepend('SUPPORT_PLOT_ICON'):
        src += Glob('Plot/Plot_Icon.c')  
    if GetDepend('SUPPORT_PLOT_VFB'):
        src += Glob('Plot/Plot_cbMemVfb.c')    
    elif GetDepend('SUPPORT_PLOT_TFT035'):
        src += Glob('Plot/Plot_cbTFT035.c')   
    elif GetDepend('SUPPORT_PLOT_MONO_H'):
        src += Glob('Plot/Plot_cbMonoH.c') 
    elif GetDepend('SUPPORT_PLOT_MONO_V'):
        src += Glob('Plot/Plot_cbMonoV.c')  
    if GetDepend('SUPPORT_PLOT_BOOT_IN_TFT_DBI'):
        src += Glob('Plot/Plot_BooInTftDbi.c') 

if GetDepend('SUPPORT_QMENU'):
    CPPPATH.append(cwd + '/QMenu')
    src += Glob('QMenu/QMenuAdj.c') 
    src += Glob('QMenu/QMenuAdjAll.c') 
    src += Glob('QMenu/QMenuAdjBit.c') 
    src += Glob('QMenu/QMenuAdjLogic.c')     
    src += Glob('QMenu/QMenuMath.c') 
    src += Glob('QMenu/QMenuMng.c') 
    src += Glob('QMenu/QMenuPara.c') 
    if GetDepend('SUPPORT_QMENU_ADJ_HEX'):
        src += Glob('QMenu/QMenuAdjHex.c') 

if GetDepend('SUPPORT_ROW_SELECTOR'):
    CPPPATH.append(cwd + '/RowSelector')    
    src += Glob('RowSelector/RowSelector.c') 
    if GetDepend('SUPPORT_ROW_SELECTOR_PLOT'):
        CPPPATH.append(cwd + '/RowSelector_PlotStr')  

if GetDepend('SUPPORT_SLIGHT_DRV'):
    CPPPATH.append(cwd + '/SLightDrv')    
    src += Glob('SLightDrv/SLightDrv.c') 

if GetDepend('SUPPORT_STRING_EX'):
    CPPPATH.append(cwd + '/StringEx')    
    src += Glob('StringEx/StringEx.c') 

if GetDepend('SUPPORT_SW_MUSIC'):
    CPPPATH.append(cwd + '/SwMusic')    
    src += Glob('SwMusic/SwMusic.c') 

if GetDepend('SUPPORT_TEST_K1_GUI'):
    CPPPATH.append(cwd + '/TestK1GUI')    
    src += Glob('TestK1GUI/TestK1GUI.c')

if GetDepend('SUPPORT_TFT_DBI'):
    CPPPATH.append(cwd + '/TftDbi')    
    src += Glob('TftDbi/TftDbi.c')      
    if GetDepend('SUPPORT_TFT_DBI_035'):
        src += Glob('TftDbi/TftDbi_035.c')
    elif GetDepend('SUPPORT_TFT_DBI_028'):
        src += Glob('TftDbi/TftDbi_028.c')
    elif GetDepend('SUPPORT_TFT_DBI_MONO'):
        src += Glob('TftDbi/TftDbi_Mng.c')
        src += Glob('TftDbi/TftDbi_MONO.c') 

    if GetDepend('SUPPORT_TFT_DBI_SPI'):
        src += Glob('TftDbi/TftDbi_SPI.c')
    elif GetDepend('SUPPORT_TFT_DBI_BX'):
        src += Glob('TftDbi/TftDbi_Bx.c')     
        if GetDepend('SUPPORT_TFT_DBI_BX8'):
                src += Glob('TftDbi/TftDbi_B8.c')  
        if GetDepend('SUPPORT_TFT_DBI_BX16'):
                src += Glob('TftDbi/TftDbi_B16.c')  

if GetDepend('SUPPORT_TFT_DRV'):
    CPPPATH.append(cwd + '/TftDrv')    
    if GetDepend('SUPPORT_TFT_DRV_STM32F4X'):
        src += Glob('TftDrv/TftDrv_STM32F4X.c')  
    else:
        src += Glob('TftDrv/TftDrv.c')  

if GetDepend('SUPPORT_TFT_TEST'):
    CPPPATH.append(cwd + '/TftTest')    
    src += Glob('TftTest/TftTest.c') 

if GetDepend('SUPPORT_TM1628_DRV'):
    CPPPATH.append(cwd + '/TM1628')
    src += Glob('TM1628/TM1628.c') 
    if GetDepend('SUPPORT_TM1628_SPI3_MIO_ONLY'):
        src += Glob('TM1628/TM1628_cbSpi3mIo.c') 
elif GetDepend('SUPPORT_TM1628M_DRV'):
    CPPPATH.append(cwd + '/TM1628M')
    src += Glob('TM1628M/TM1628.c') 

if GetDepend('SUPPORT_TOUCH_PAD'):
    CPPPATH.append(cwd + '/TouchPad')    
    src += Glob('TouchPad/TouchPad.c') 
    if GetDepend('SUPPORT_TOUCH_FT54206'):
        src += Glob('TouchPad/TouchPad_cbFT5206.c') 
    elif GetDepend('SUPPORT_TOUCH_GT9X'):
        src += Glob('TouchPad/TouchPad_cbGT9X.c') 

if GetDepend('SUPPORT_TOUCH_RECT'):
    CPPPATH.append(cwd + '/TouchRect')
    src += Glob('TouchRect/TouchRect.c') 

if GetDepend('SUPPORT_UI_PAGE'):
    CPPPATH.append(cwd + '/UiPage')
    src += Glob('UiPage/UiPage.c') 

if GetDepend('SUPPORT_UI_TIPS'):
    CPPPATH.append(cwd + '/UiTips')
    src += Glob('UiTips/UiTips.c') 

#增加SUPPORT_EX_PREINCLUDE定义以预包含Preinclude.h
predefine = ['SUPPORT_EX_PREINCLUDE']
group = DefineGroup('CompGUI', src, depend = [''], CPPPATH=CPPPATH, CPPDEFINES = predefine)
Return('group')